<?php
#by reemo 2012
class ShowKollaiderPage extends AbstractPage
{
	public static $requireModule = 0;

	function __construct() 
	{
		parent::__construct();
	}
	
	public function send()
	{
		global $USER, $PLANET, $LNG, $CONF, $pricelist, $resource, $reslist;

			$Cost = round($pricelist['69']['cost']['901'] * pow($pricelist['69']['factor'], $PLANET['kalaider']));
		
			if($USER['atm'] < $Cost )
			{
				$this->printMessage("Недостаточно Антиматерии", true, array("game.php?page=kollaider", 2));
				return;
			}

			$USER['atm']			-= $Cost;
			
			$GLOBALS['DATABASE']->query("UPDATE ".PLANETS." SET
				 	`kalaider` = `kalaider` + 1
				 	WHERE `id` = '".$PLANET["id"]."';");	
			
			$this->redirectTo('game.php?page=kollaider');

	}
	
	function show()
	{
		global $PLANET, $LNG, $CONF, $pricelist, $ProdGrid, $reslist, $USER;
		
		
		if($PLANET['planet_type'] != 3)
		{
			$this->redirectTo('game.php');
			return;
		}
		
		$Cost = round($pricelist['69']['cost']['901'] * pow($pricelist['69']['factor'], $PLANET['kalaider']));
		$BuildLevel = $PLANET['kalaider'] +1;
		$Production	= eval(ResourceUpdate::getProd($ProdGrid['69']['production']['921']));
	
		
		$this->tplObj->assign_vars(array(
			'Cost'				=> $Cost,
			'lvl_k'				=> $PLANET['kalaider'],
			'Production'		=> $Production,
		));
		
		$this->display('page.kalaider.tpl');
	}
}
?>